﻿#include "FITKAbaMaterialExpansion.h"


Interface::FITKAbaMaterialBehaviorEnum::FITKAbaMaterialBehaviorType Interface::FITKAbaMaterialExpansion::getMaterialBehaviorType()
{
    return Interface::FITKAbaMaterialBehaviorEnum::FITKAbaMaterialBehaviorType::Expansion;
}

Interface::FITKAbaMaterialBehaviorEnum::FITKAbaMaterialExpansionType Interface::FITKAbaMaterialExpansion::getExpansionType() const
{
    return m_expansionType;
}

void Interface::FITKAbaMaterialExpansion::setExpansionType(FITKAbaMaterialBehaviorEnum::FITKAbaMaterialExpansionType type)
{
    m_expansionType = type;
}

double Interface::FITKAbaMaterialExpansion::getReferenceTemperature() const
{
    return m_refTemperature;
}

void Interface::FITKAbaMaterialExpansion::setReferenceTemperature(double value)
{
    m_refTemperature = value;
}

bool Interface::FITKAbaMaterialExpansion::getUseTemperatureDependentData() const
{
    return m_useTemperatureDependentData;
}

void Interface::FITKAbaMaterialExpansion::setUseTemperatureDependentData(bool stat)
{
    m_useTemperatureDependentData = stat;
    if (!m_useTemperatureDependentData)
    {
        m_isotropicDatas.resize(1);
        m_orthotropicDatas.resize(1);
        m_anisotropicDatas.resize(1);
    }
}

int Interface::FITKAbaMaterialExpansion::getIsotropicNumberOfRows() const
{
    return m_isotropicDatas.size();
}

void Interface::FITKAbaMaterialExpansion::setIsotropicNumberOfRows(int rows)
{
    if (!m_useTemperatureDependentData)
        return;
    if (rows > 1)
    {
        m_isotropicDatas.resize(rows);
    }
}

void Interface::FITKAbaMaterialExpansion::insertIsotropicRow(int index)
{
    if (!m_useTemperatureDependentData)
        return;
    m_isotropicDatas.insert(index, ExpansionIsotropicData());
}

void Interface::FITKAbaMaterialExpansion::removeIsotropicRow(int index)
{
    if (!m_useTemperatureDependentData)
        return;
    if (m_isotropicDatas.size() == 1)
        return;
    if (index >=0 && index < m_isotropicDatas.size())
        m_isotropicDatas.removeAt(index);
}

double Interface::FITKAbaMaterialExpansion::getIsotropicExpansionCoeff(int index) const
{
    if (index >= 0 && index < m_isotropicDatas.size())
        return m_isotropicDatas[index].getExpansionCoeff();
    return 0.0;
}

void Interface::FITKAbaMaterialExpansion::setIsoTropicExpansionCoeff(double value, int index)
{
    if (index >= 0 && index < m_isotropicDatas.size())
        m_isotropicDatas[index].setExpansionCoeff(value);
}

double Interface::FITKAbaMaterialExpansion::getIsotropicTemperature(int index) const
{
    if (index >= 0 && index < m_isotropicDatas.size())
        return m_isotropicDatas[index].getTemperature();
    return 0.0;
}

void Interface::FITKAbaMaterialExpansion::setIsotropicTemperature(double value, int index)
{
    if (index >= 0 && index < m_isotropicDatas.size())
        m_isotropicDatas[index].setTemperature(value);
}


